import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';

export const columns: BasicColumn[] = [
  {
    title: '订单号',
    dataIndex: 'airOrderId',
    width: 150,
  },
  {
    title: '出票时间',
    dataIndex: 'reservedDate',
    width: 150,
    format: 'YYYY-MM-DD HH:mm:ss',
    // placeholder: '起飞日期起',
    // valueFormat: 'YYYY-MM-DD',
    // showTime: { format: 'HH:mm:ss' },
  },
  {
    title: '预定人',
    dataIndex: 'bookerName',
    width: 80,
  },
  {
    title: '乘机人',
    dataIndex: 'passengerName',
    width: 80,
  },
  {
    title: '行程',
    dataIndex: 'orgName',
    width: 120,
    customRender: ({ record }) => {
      return record.orgName + '-' + record.dstName;
    },
  },
  { title: '票号', dataIndex: 'ticketNum', width: 140 },
  {
    title: '起飞日期',
    dataIndex: 'deptDate',
    width: 120,
  },
  {
    title: '到达日期',
    dataIndex: 'arriveDate',
    width: 120,
  },
  {
    title: '预约类型',
    dataIndex: 'travelType',
    width: 80,
    customRender: ({ text }) => {
      if (text === 0) {
        return h(Tag, { color: 'red' }, () => '无审批单');
      } else if (text === 1) {
        return h(Tag, { color: 'green' }, () => '有审批单');
      }
    },
  },
  {
    title: '状态',
    dataIndex: 'orderStatus',
    width: 60,
    customRender: ({ text }) => {
      if (text === 0) {
        return h(Tag, { color: 'red' }, () => '无效');
      } else if (text === 1) {
        return h(Tag, { color: 'yellow' }, () => '原始');
      } else if (text === 2) {
        return h(Tag, { color: 'green' }, () => '已出票');
      }
    },
  },
  {
    title: '总金额',
    dataIndex: 'sumPrice',
    width: 60,
  },
];
export const columns1: BasicColumn[] = [
  {
    title: '订单号',
    dataIndex: 'airOrderId',
    width: 150,
  },
  {
    title: '退票时间',
    dataIndex: 'returnDate',
    width: 150,
  },
  {
    title: '原订单号',
    dataIndex: 'returnOldOrderId',
    width: 150,
  },
  {
    title: '申请人',
    dataIndex: 'returnLinkMan',
    width: 80,
  },
  {
    title: '乘机人',
    dataIndex: 'passengerName',
    width: 80,
  },
  {
    title: '出发地',
    dataIndex: 'orgname',
    width: 80,
  },
  {
    title: '目的地',
    dataIndex: 'dstname',
    width: 80,
  },

  {
    title: '退票性质',
    dataIndex: 'quitReason',
    width: 80,
    customRender: ({ text }) => {
      if (text === '2') {
        return h(Tag, { color: 'red' }, () => '非自愿');
      } else if (text === '-1') {
        return h(Tag, { color: 'green' }, () => '自愿');
      }
    },
  },
  {
    title: '退票状态',
    dataIndex: 'quitIsRuse',
    width: 80,
    customRender: ({ text }) => {
      if (text === 2) {
        return h(Tag, { color: 'green' }, () => '退票完成');
      } else if (text === 3) {
        return h(Tag, { color: 'yellow' }, () => '退票申请');
      } else if (text === 5) {
        return h(Tag, { color: 'red' }, () => '退票打回');
      }
    },
  },
  {
    title: '预约类型',
    dataIndex: 'travelType',
    width: 80,
    customRender: ({ text }) => {
      if (text === 0) {
        return h(Tag, { color: 'red' }, () => '无审批单');
      } else if (text === 1) {
        return h(Tag, { color: 'green' }, () => '有审批单');
      }
    },
  },
  {
    title: '总金额',
    dataIndex: 'sumPrice',
    width: 60,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'airOrderId',
    label: '订单号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      // prefix: '',
      style: 'width: 220px',
    },
  },
  {
    field: 'passengerName',
    label: '乘机人',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      // prefix: '乘机人：',
      style: 'width: 220px',
    },
  },
  {
    field: 'passengerDeptName',
    label: '部门编号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      // prefix: '',
      style: 'width: 220px',
    },
  },
  {
    field: 'fieldTime',
    component: 'RangePicker',
    label: '起飞日期',
    colProps: {
      span: 6,
    },
    componentProps: {
      placeholder: ['起飞日期起', '起飞日期止'],
      style: 'width: 220px',
    },
  },
  // {
  //   field: 'deptDateStart',
  //   label: '',
  //   component: 'DatePicker',
  //   colProps: { span: 3 },
  //   componentProps: {
  //     format: 'YYYY-MM-DD',
  //     placeholder: '起飞日期起',
  //     valueFormat: 'YYYY-MM-DD',
  //     // showTime: { format: 'HH:mm:ss' },
  //   },
  // },
  // {
  //   field: 'deptDateEnd',
  //   label: '',
  //   component: 'DatePicker',
  //   colProps: { span: 3 },
  //   componentProps: {
  //     format: 'YYYY-MM-DD',
  //     placeholder: '起飞日期止',
  //     valueFormat: 'YYYY-MM-DD',
  //     // showTime: { format: 'HH:mm:ss' },
  //   },
  // },

  {
    field: 'orgname',
    label: '出发地',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '',
      // prefix: '',
      style: 'width: 220px',
    },
  },
  {
    field: 'dstname',
    label: '目的地',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      // prefix: '',
      style: 'width: 220px',
    },
  },
  {
    field: 'deptName',
    label: '项目编号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      // prefix: '',
      style: 'width: 220px',
    },
  },

  {
    field: 'reservedDate',
    label: '预约时间',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      format: 'YYYY-MM-DD',
      placeholder: '预约时间',
      valueFormat: 'YYYY-MM-DD',
      style: 'width: 220px',
      // showTime: { format: 'HH:mm:ss' },
    },
  },
  {
    field: 'ticketNum',
    label: '票号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: ' ',
      prefix: '',
      style: 'width: 220px',
    },
  },
  {
    field: 'travelType',
    label: '预约类型',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '',
      options: [
        { label: '有审批单', value: 1 },
        { label: '无审批单', value: 0 },
      ],
      style: 'width: 220px',
    },
  },
  {
    field: 'orderStatus',
    label: '订单状态',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '',
      options: [
        { label: '已出票订单', value: 2 },
        { label: '原始订单', value: 1 },
        { label: '无效订单', value: 0 },
      ],
      style: 'width: 220px',
    },
  },
];
